home *** CD-ROM | disk | FTP | other *** search
- function mSelectFoe(strID)
- {
- this.oFoe = this["oFoe_" + strID];
- var i = 1;
- while(i < 5)
- {
- var name = "Mojo" + i;
- if(name != strID)
- {
- this["oFoe_" + name].unloadMovie();
- }
- i++;
- }
- }
- function mInitObjects()
- {
- this.mKillObstacules();
- this.oChar.oWave = this.oWave;
- this.oChar.intPosX = 0;
- this.oChar.intPosY = -10;
- this.oChar.intVelX = 10;
- this.oChar.intVelY = 0;
- this.oChar.intGravity = -1.5;
- this.oChar.strmedia = "wave";
- this.oChar.intAngle = -0.7853981633974483;
- this.oChar.strMode = "surfing";
- this.mSetPose("surfing");
- this.oWave.oChar = this.oChar;
- this.oWave.oClosingWave = this.oClosingWave;
- this.oWave.intPosX = -5000;
- this.oWave.intPosY = 0;
- this.oWave.intVelX = 15;
- this.oWave.intVelY = 0;
- this.oWave.intGround = -215;
- this.oWave.intFinish = 10000;
- this.oControls.oChar = this.oChar;
- this.oControls.intStep = 0.09817477042468103;
- this.oControls.mult = 2;
- if(this._parent.intLevel == 1)
- {
- this.mSelectFoe("Mojo1");
- this.oFoe.intGapX = 250;
- this.oFoe.intPosX = 5500;
- this.oFoe.intPosY = -45;
- this.oFoe.intVelX = 0;
- this.oFoe.defaultTime = 30;
- this.oFoe.defaultBombSpeed = -25;
- this.oWave.intPosX = -3000;
- this.oWave.intVelX = 11;
- this.mNewObstacule(500,-50,0,0,"obstaculo_04");
- this.mNewObstacule(1000,25,0,0,"energia_01");
- this.mNewObstacule(1000,-100,0,0,"energia_03");
- this.mNewObstacule(1250,-150,0,0,"obstaculo_05");
- this.mNewObstacule(1500,-100,0,0,"obstaculo_07");
- this.mNewObstacule(1750,-50,0,0,"obstaculo_05");
- this.mNewObstacule(2000,-175,0,0,"obstaculo_08");
- this.mNewObstacule(2250,-100,0,0,"obstaculo_04");
- this.mNewObstacule(2500,0,0,0,"energia_01");
- this.mNewObstacule(2750,50,0,0,"energia_01");
- this.mNewObstacule(3000,100,0,0,"energia_01");
- this.mNewObstacule(3500,100,0,0,"energia_03");
- this.mNewObstacule(3500,0,0,0,"obstaculo_08");
- this.mNewObstacule(3500,-150,0,0,"obstaculo_06");
- this.mNewObstacule(3750,-100,0,0,"obstaculo_02");
- this.mNewObstacule(4000,-50,0,0,"obstaculo_03");
- this.mNewObstacule(4500,25,0,0,"energia_01");
- this.mNewObstacule(4750,75,0,0,"energia_01");
- this.mNewObstacule(5000,125,0,0,"energia_01");
- this.mNewObstacule(5000,0,0,0,"obstaculo_08");
- this.mNewObstacule(8250,-100,0,0,"obstaculo_06");
- this.mNewObstacule(8500,0,0,0,"obstaculo_08");
- }
- if(this._parent.intLevel == 2)
- {
- this.mSelectFoe("Mojo2");
- this.oFoe.intGapX = 250;
- this.oFoe.intPosX = 5000;
- this.oFoe.intPosY = -45;
- this.oFoe.intVelX = 0;
- this.oFoe.defaultTime = 25;
- this.oFoe.defaultBombSpeed = -25;
- this.oWave.intPosX = -3000;
- this.oWave.intVelX = 12;
- this.mNewObstacule(500,-50,0,0,"obstaculo_04");
- this.mNewObstacule(500,-150,0,0,"obstaculo_04");
- this.mNewObstacule(1000,-100,0,0,"energia_03");
- this.mNewObstacule(1000,25,0,0,"energia_01");
- this.mNewObstacule(1000,75,0,0,"energia_01");
- this.mNewObstacule(1250,-150,0,0,"obstaculo_07");
- this.mNewObstacule(1750,-50,0,0,"obstaculo_07");
- this.mNewObstacule(2000,-175,0,0,"obstaculo_08");
- this.mNewObstacule(2250,-100,0,0,"obstaculo_04");
- this.mNewObstacule(2500,0,0,0,"energia_01");
- this.mNewObstacule(2750,50,0,0,"energia_01");
- this.mNewObstacule(3000,25,-10,0,"mc_pelicano");
- this.mNewObstacule(3250,150,0,0,"energia_01");
- this.mNewObstacule(3500,100,0,0,"energia_03");
- this.mNewObstacule(3500,-150,0,0,"obstaculo_06");
- this.mNewObstacule(3750,-100,0,0,"obstaculo_02");
- this.mNewObstacule(4000,25,-10,0,"mc_pelicano");
- this.mNewObstacule(4000,-50,0,0,"obstaculo_03");
- this.mNewObstacule(4500,25,0,0,"energia_01");
- this.mNewObstacule(4750,75,0,0,"energia_01");
- this.mNewObstacule(5000,125,0,0,"energia_01");
- this.mNewObstacule(5000,0,0,0,"obstaculo_08");
- this.mNewObstacule(5500,25,-10,0,"mc_pelicano");
- this.mNewObstacule(6500,25,-10,0,"mc_pelicano");
- this.mNewObstacule(9000,25,0,0,"mc_pelicano");
- this.mNewObstacule(9500,25,0,0,"mc_pelicano");
- this.mNewObstacule(9500,-100,0,0,"obstaculo_04");
- }
- if(this._parent.intLevel == 3)
- {
- this.mSelectFoe("Mojo3");
- this.oFoe.intGapX = 250;
- this.oFoe.intPosX = 5000;
- this.oFoe.intPosY = -45;
- this.oFoe.intVelX = 0;
- this.oFoe.defaultTime = 20;
- this.oFoe.defaultBombSpeed = -20;
- this.oWave.intPosX = -2500;
- this.oWave.intVelX = 12;
- this.mNewObstacule(500,-50,0,0,"obstaculo_01");
- this.mNewObstacule(500,-125,0,0,"obstaculo_02");
- this.mNewObstacule(1000,50,0,0,"energia_06");
- this.mNewObstacule(1250,-100,0,0,"obstaculo_06");
- this.mNewObstacule(1500,-150,0,0,"obstaculo_08");
- this.mNewObstacule(1750,-75,0,0,"obstaculo_07");
- this.mNewObstacule(2000,-175,0,0,"obstaculo_08");
- this.mNewObstacule(2500,-100,0,0,"mc_tiburon");
- this.mNewObstacule(2500,0,0,0,"energia_01");
- this.mNewObstacule(2750,50,0,0,"energia_01");
- this.mNewObstacule(3000,100,0,0,"energia_01");
- this.mNewObstacule(3250,125,0,0,"energia_06");
- this.mNewObstacule(3500,100,0,0,"energia_06");
- this.mNewObstacule(3500,0,0,0,"obstaculo_08");
- this.mNewObstacule(3750,-50,0,0,"obstaculo_02");
- this.mNewObstacule(4000,-100,0,0,"obstaculo_03");
- this.mNewObstacule(4500,50,0,0,"energia_01");
- this.mNewObstacule(4750,100,0,0,"energia_01");
- this.mNewObstacule(5000,125,0,0,"energia_06");
- this.mNewObstacule(5000,0,0,0,"obstaculo_08");
- this.mNewObstacule(5000,-100,0,0,"mc_tiburon");
- this.mNewObstacule(5250,100,0,0,"energia_06");
- this.mNewObstacule(5300,100,0,0,"energia_06");
- this.mNewObstacule(9000,-100,-10,0,"mc_tiburon");
- this.mNewObstacule(4250,40,0,0,"obstaculo_10_vida");
- }
- if(this._parent.intLevel == 4)
- {
- this.mSelectFoe("Mojo4");
- this.oFoe.intGapX = 250;
- this.oFoe.intPosX = 5000;
- this.oFoe.intPosY = -45;
- this.oFoe.intVelX = 0;
- this.oFoe.defaultTime = 20;
- this.oFoe.defaultBombSpeed = -20;
- this.oWave.intPosX = -2500;
- this.oWave.intVelX = 13;
- this.mNewObstacule(500,-150,0,0,"obstaculo_01");
- this.mNewObstacule(750,-50,0,0,"obstaculo_04");
- this.mNewObstacule(1000,50,0,0,"energia_01");
- this.mNewObstacule(1000,100,0,0,"energia_01");
- this.mNewObstacule(1000,125,0,0,"energia_06");
- this.mNewObstacule(1025,125,0,0,"energia_06");
- this.mNewObstacule(1250,-100,0,0,"obstaculo_05");
- this.mNewObstacule(1750,-75,0,0,"obstaculo_07");
- this.mNewObstacule(2000,0,0,0,"obstaculo_08");
- this.mNewObstacule(2250,-100,0,0,"mc_tiburon");
- this.mNewObstacule(2500,50,0,0,"energia_01");
- this.mNewObstacule(2750,75,0,0,"energia_01");
- this.mNewObstacule(3000,100,0,0,"energia_06");
- this.mNewObstacule(3000,25,-10,0,"mc_pelicano");
- this.mNewObstacule(3250,100,0,0,"energia_06");
- this.mNewObstacule(3500,50,0,0,"energia_01");
- this.mNewObstacule(3500,0,0,0,"obstaculo_08");
- this.mNewObstacule(3500,-100,0,0,"obstaculo_06");
- this.mNewObstacule(3750,-50,0,0,"obstaculo_03");
- this.mNewObstacule(4000,25,-10,0,"mc_pelicano");
- this.mNewObstacule(4000,-100,0,0,"obstaculo_02");
- this.mNewObstacule(4500,50,0,0,"energia_01");
- this.mNewObstacule(4750,100,0,0,"energia_01");
- this.mNewObstacule(5000,125,0,0,"energia_06");
- this.mNewObstacule(5000,0,0,0,"obstaculo_08");
- this.mNewObstacule(5500,25,-10,0,"mc_pelicano");
- this.mNewObstacule(5500,-100,0,0,"mc_tiburon");
- this.mNewObstacule(6500,25,-10,0,"mc_pelicano");
- this.mNewObstacule(8000,-100,0,0,"mc_tiburon");
- this.mNewObstacule(9000,25,0,0,"mc_pelicano");
- this.mNewObstacule(9500,25,0,0,"mc_pelicano");
- this.mNewObstacule(9500,-100,0,0,"mc_tiburon");
- this.mNewObstacule(4250,40,0,0,"obstaculo_10_vida");
- }
- this.arrObs.push(this.oFoe);
- }
- function mInitGame()
- {
- this.mInitObjects();
- }
- function mDraw()
- {
- var intCamX = 300;
- var CamIntPosX = this.oChar.intPosX;
- this.oChar._x = intCamX;
- this.oChar._y = 165 - this.oChar.intPosY;
- this.oChar.oImage.mSetAngle(this.oChar.intAngle);
- this.oWave._y = this.oWave.intY;
- this.oClosingWave._y = this.oWave.intY;
- this.oClosingWave._x = intCamX + CamIntPosX - this.oWave.intPosX;
- var i = 0;
- while(i < this.arrObs.length)
- {
- var obs = this.arrObs[i];
- obs._x = intCamX + CamIntPosX - obs.intPosX;
- obs._y = 165 - obs.intPosY;
- this.oProgressBar.mRefresh();
- i++;
- }
- this.oChar._y += this.oChar.intPosY / 3;
- this.oWave._y += this.oChar.intPosY / 3;
- this.oClosingWave._y += this.oChar.intPosY / 3;
- var i = 0;
- while(i < this.arrObs.length)
- {
- var obs = this.arrObs[i];
- obs._y += this.oChar.intPosY / 3;
- i++;
- }
- }
- function mNewObstacule(intX, intY, intVelX, intVelY, strType)
- {
- this.intDepth = this.intDepth + 1;
- var newdepth = this.intDepth;
- var newname = "oObs" + newdepth;
- this.attachMovie(strType,newname,newdepth);
- this[newname].intPosX = intX;
- this[newname].intPosY = intY;
- this[newname].intVelX = intVelX;
- this[newname].intVelY = intVelY;
- this.arrObs.push(this[newname]);
- }
- function mNewScore(intscore, aintX, aintY, aintDepth)
- {
- this.intDepth = this.intDepth + 1;
- var newdepth = this.intDepth;
- var newname = "puf_" + newdepth;
- this.attachMovie("energia_puf",newname,newdepth);
- this[newname].intPosX = aintX;
- this[newname].intPosY = aintY;
- this[newname].intVelY = 3;
- this[newname].strScore = intscore;
- this.arrObs.push(this[newname]);
- this.mAddScore(intscore);
- this.sndBonus.start();
- }
- function mStepFrame()
- {
- var newDate = new Date();
- if(this.oldDate == 0)
- {
- this.oldDate = newDate;
- }
- var dT = newDate - this.oldDate;
- var interval = this.velocidad * dT / 1000;
- this.oldDate = newDate;
- this.strInterval = interval;
- if(interval > 2)
- {
- interval = 2;
- }
- this.oControls.mStepFrame(interval);
- this.oWave.mStepFrame(interval);
- this.oChar.mStepFrame(interval);
- var i = 0;
- while(i < this.arrObs.length)
- {
- var obs = this.arrObs[i];
- obs.mStepFrame(interval);
- i++;
- }
- this.mDraw();
- this.mDoScore();
- }
- function mKillObject(aObject)
- {
- var i = 0;
- while(i < this.arrObs.length)
- {
- if(this.arrObs[i] == aObject)
- {
- aObject.unloadMovie();
- this.arrObs.splice(i,1);
- }
- i++;
- }
- }
- function mKillObstacules()
- {
- var i = 0;
- while(i < this.arrObs.length)
- {
- this.arrObs.unloadMovie();
- i++;
- }
- this.arrObs = new Array();
- }
- function mResetWave()
- {
- this.oChar.mReset();
- this.oFoe.mReset();
- this.oWave.mReset();
- }
- function mDoScore()
- {
- var checkPoint = Math.floor(this.oChar.intPosX / this.intCheckpointGap);
- if(checkpoint > this.arrCheckPoint)
- {
- this.arrCheckPoint = checkpoint;
- this.mAddScore(this.intPointsXGap);
- }
- }
- function mAddScore(intscore)
- {
- this._parent.mAddScore(intscore);
- this.oScore.mSetScore(this._parent.intScore);
- }
- function mSetCharacter(astrchar)
- {
- this._parent.mSetCharacter(astrchar);
- }
- function mResumeLevel()
- {
- this._parent.mResumeLevel();
- }
- function mStartGame()
- {
- this._parent.mStartGame();
- }
- function mLooseLife()
- {
- this.sndFondo.stop();
- this.strCommand = "looselife";
- this.gotoAndPlay("nocontrol");
- }
- function mGameOver()
- {
- this._parent.mGameOver();
- }
- function mJumpLevel()
- {
- this.strCommand = "jumplevel";
- this.gotoAndPlay("nocontrol");
- }
- function mRelease()
- {
- this.sndFondo.stop();
- if(this.strCommand == "looselife")
- {
- this._parent.mLooseLife();
- }
- if(this.strCommand == "jumplevel")
- {
- this._parent.mJumpLevel();
- }
- }
- this.sndFondo = new Sound(this);
- this.sndFondo.attachSound("base_juego.wav");
- this.sndBonus = new Sound(this);
- this.sndBonus.attachSound("bonus.wav");
- this.sndFondo.start(0,9999);
- this.velocidad = 18;
- this.intCheckpointGap = 100;
- this.intPointsXGap = 5;
- this["oChar_" + this._parent.strChar].duplicateMovieClip("oChar",500);
- this.oChar_bl.unloadMovie();
- this.oChar_bb.unloadMovie();
- this.oChar_bc.unloadMovie();
- this.hexColorRopa = this._parent.hexColorRopa;
- this.hexColorTabla = this._parent.hexColorTabla;
- this.oClosingWave_dumb.duplicateMovieClip("oClosingWave",504);
- this.oClosingWave_dumb.unloadMovie();
- this.arrObs = new Array();
- this.intDepth = 50;
-